// 完整的深拷贝

function deepClone() {
    let newObj
    if(obj instanceof Object) {
        if(obj instanceof Array) {
             newObj = new Array()
        }
        else if(obj instanceof Function) {
             newObj = function() {
                 obj.apply(this, arguments)
             }
        }
        else if(obj instanceof Date) {
            newObj = new Date(obj)
        }

        for(let key in obj) {
            if(obj.hasOwnProperty(key)) {
                newObj[key] = newObj[key] instanceof Object ? deepClone(obj[key]) : obj[key]
            }
        }
    }

    return newObj
}